package by.yakusekmaxim.bookgid.webapp.page.admin.series;

import javax.inject.Inject;

import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;

import by.yakusekmaxim.bookgid.datamodel.Series;
import by.yakusekmaxim.bookgid.services.SeriesService;
import by.yakusekmaxim.bookgid.webapp.page.AdminLayout;

public class SeriesPage extends AdminLayout {
	
	
	@Inject
	private SeriesService seriesService;
	
	protected void onInitialize() {
		super.onInitialize();
		
		add(new Link<Object>("linkEditSeriesPage") {
			@Override
			public void onClick() {
				setResponsePage(new EditSeriesPage(new Series()));
			}
		});
		
		add(new Label("count", seriesService.getCount()));
		add(new SeriesListPanel("seriesList"));
	}
	
	@Override
	protected IModel<String> getPageTitle() {
		return new ResourceModel("adminmenu.series");
	}
	@Override
	protected WebMarkupContainer getTarget() {
		return targetSeries;
	}

}
